﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Globalization;

namespace SalaryChannel
{
    public partial class PhotoInfo : UserControl
    {
        /// <summary>
        /// SoapClient which get photo information from server
        /// </summary>
        // private PhotoServiceReference.PhotoServiceSoapClient photoService;


        /// <summary>
        /// Event of MouseLeftButtonDown
        /// </summary>
        public new event MouseButtonEventHandler MouseLeftButtonDown;

        public new Visibility Visibility
        {
            get
            {
                return base.Visibility;
            }
            set
            {
                base.Visibility = value;
                if (value == System.Windows.Visibility.Visible)
                {
                    // BindData();
                }
            }
        }

        public PhotoInfo()
        {
            InitializeComponent();
        }

        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {

        }



        public void BindData(ViewService.VW_PhotoInfor infor)
        {
            if (infor == null) return;

            this.title.Text = infor.Title;
            time.Text = infor.CreateTime.ToShortDateString() + " " + infor.CreateTime.ToShortTimeString();
            owner.Text = infor.Owner;
            channel.Text = infor.ChannelName;
            albumName.Text = infor.AlbumName;
            description.Text = infor.Description;

        }

        public void Clear()
        {
            this.title.Text = string.Empty;
            time.Text = string.Empty;
            owner.Text = string.Empty;
            channel.Text = string.Empty;
            albumName.Text = string.Empty;
            description.Text = string.Empty;
        }

        private void PhotoInfoButton_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            if (MouseLeftButtonDown != null)
            {
                MouseLeftButtonDown(sender, e);
            }
        }

    }
}
